<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title>title</title>
		<link rel="stylesheet" type="text/css" href="../../css/api.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/common.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/iosSelect.css"/>
		<style>
			body {
			}
		</style>
	</head>
	<body>
		<header class="top-header">
			<div class="top-nav-content flex-container flex-between flex-center-v">
				<div class="back-pre-pg top-nav-left icon-arrow-left"></div>
				<div>
					日历
				</div>
				<div id="btn-commit" class="top-nav-right">
					确认
				</div>
			</div>
		</header>
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/common.js"></script>
	<script type="text/javascript" src="../../script/date_data.js"></script>
	<script type="text/javascript" src="../../script/iscroll.js"></script>
	<script type="text/javascript" src="../../script/iosSelect.js"></script>
	<script type="text/javascript">
		//最终日期
		var mY;
		var mM;

		apiready = function() {
			//适配iOS7+，Android4.4+状态栏沉浸式效果，详见config文档statusBarAppearance字段
			$api.fixStatusBar($api.dom('header'));
			initView();
			openDateJS();
		};
		function initView() {
			var btn1 = document.getElementById('btn-commit');
			btn1.onclick = function() {
				triggerDateListener();
				api.closeWin({
				});
			}
			MyCom.backPrePg();
		}

		/**
		 *通过js插件打开日历
		 */
		function openDateJS() {

			var date = new Date();
			mY=date.getFullYear();
			mM=(date.getMonth() + 1);
			var sanguoSelect = new IosSelect(2, [suData, weiData], {
				title : date.getFullYear() + '年' + (date.getMonth() + 1) + '月',
				itemHeight : 35,
				headerHeight : 88,
				rootMT : $api.dom('header').offsetHeight,
				callback : function(selectOneObj, selectTwoObj) {
				},
				callbackEnd : function(selectOneObj, selectTwoObj) {
					mY = selectOneObj.value;
					mM = selectTwoObj.value;
					console.log('y=' + mY + '   m=' + mM);
				}
			});
		}

		/**
		 * 触发“日期选择”的监听
		 */
		function triggerDateListener() {
			var date=new Object();
			date.type=1;
			date.y=mY;
			date.m=mM;
			api.sendEvent({
				name : 'DateListener',
				extra : date
			});
		}
	</script>
</html>
